exports.install = function (Vue, options) {
  const msg = "";//手机提示
  const msgEmail = "";//邮箱提示
  const msgUser = "";//用户名提示
  const msgPw = "";//密码提示
  const msgCode = ""; //验证码提示
  const msgAge = ""; //年龄提示
  var that = this;
  //验证手机号
  Vue.prototype.isPhone = function ($poneInput) {
    var myreg = /^1[3-578]\d{9}$/;
    if (myreg.test($poneInput)) {
      that.msg = ""
      return true;
    } else if ($poneInput == '') {
      that.msg = "请输入手机号";
      return false;
    } else {
      that.msg = "请输入正确的手机号"
      return false;
    }
  };
  //验证邮箱
  Vue.prototype.isEmail = function ($email) {
    var myreg1 = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
    if (myreg1.test($email)) {
      that.msgEmail = ""
      return true;
    } else {
      that.msgEmail = "请输入正确的邮箱"
      return false;
    }
  };
  //验证用户名
  Vue.prototype.isUserName = function ($username) {
    var myreg2 = /^[a-zA-Z]{1}([a-zA-Z0-9]|[._]){5,19}$/;
    if (myreg2.test($username)) {
      that.msgUser = ""
      return true;
    } else {
      that.msgUser = "请输入6-20位以字母开头、可带数字、“_”、“.”的用户名"
      return false;
    }
  };
  //验证密码
  Vue.prototype.isPw = function ($pw) {
    var myreg2 = /^[A-Za-z0-9]{6,20}$/;
    if (myreg2.test($pw)) {
      that.msgPw = ""
      return true;
    } else {
      that.msgPw = "请输入6-20位以字母、数字组成的密码"
      return false;
    }
  };
  Vue.prototype.isCode = function (code) {
    let reg = /^[0-9]*$/;
    if (!code) {
      that.msgCode = '请输入验证码';
      return false;
    } else if (!reg.test(code)) {
      that.msgCode = '验证码为数字';
      return false;
    }
    that.msgCode = '';
    return true;
  };
  Vue.prototype.isAge = function (age) {
    if (!age) {
      that.msgAge = '请选择孩子年龄';
      return false;
    }
    that.msgAge = '';
    return true;
  };
}
